package gameUi
{
	import flash.display.Sprite;
	import flash.events.KeyboardEvent;
	import flash.text.TextField;
	import flash.text.TextFieldType;
	import flash.ui.Keyboard;

	public class LoginUI extends Sprite
	{
		private var _txtUserId:TextField;
		private var _txtPassword:TextField;
		
		private var _txtInfo:TextField;
		
		/**
		 * 测试登录类
		 **/
		public function LoginUI()
		{
			_txtUserId = new TextField();
			_txtPassword = new TextField();
			_txtPassword.displayAsPassword = true;
			_txtUserId.x = 300;
			_txtUserId.y = 300;
			_txtUserId.height = 30;
			_txtUserId.border = true;
			_txtUserId.type = TextFieldType.INPUT;
			addChild(_txtUserId);
			_txtPassword.x = 300;
			_txtPassword.y = 400;
			_txtPassword.height = 30;
			_txtPassword.type = TextFieldType.INPUT;
			_txtPassword.border = true;
			addChild(_txtPassword);
			
			_txtInfo = new TextField();
			_txtInfo.x = 300;
			_txtInfo.y = 500;
			_txtInfo.height = 30;
			addChild(_txtInfo);
			
			this.addEventListener(KeyboardEvent.KEY_DOWN,onKeyDown);
		}
		
		private function onKeyDown(e:KeyboardEvent):void{
			if(e.keyCode == Keyboard.ENTER){
				BlackJack.loginSender.askLoginPack();
			}
		}
		
		/**
		 * 用户名
		 **/
		public function get userId():String{
			return _txtUserId.text;
		}
		
		/**
		 * 密码
		 **/
		public function get password():String{
			return _txtPassword.text;
		}
		
		/**
		 * 提示信息
		 **/
		public function tipStr(tip:String):void{
			_txtInfo.text = tip;
		}
	}
}